;; Test for-each with vector support
(display "Testing for-each with vector support...\n\n")

;; Utility function for testing - displays values with a newline
(define display-with-newline
  (lambda (x) 
    (display x) 
    (newline) 
  )
)

;; Test 1: Basic usage with a vector
(display "Test 1: Basic for-each with a vector\n")
(for-each display-with-newline #(1 2 3 4 5))
(newline)

;; Test 2: Using for-each to build a side-effect (sum) with vector
(display "Test 2: Using for-each to accumulate a sum with vector\n")
(define sum 0)
(for-each (lambda (x) (set! sum (+ sum x))) #(1 2 3 4 5))
(display "Sum: ")
(display sum)
(newline)
(newline)

;; Test 3: Using for-each with multiple arguments (mix of list and vector)
(display "Test 3: for-each with mixed list and vector arguments\n")
(define result '())
(for-each 
  (lambda (x y) 
    (set! result (cons (* x y) result))
  )
  #(1 2 3 4 5) 
  '(6 7 8 9 10) 
)
(display "Results (reversed): ")
(display result)
(newline)
(newline)

;; Test 4: for-each with multiple vectors
(display "Test 4: for-each with multiple vectors\n")
(define result2 '())
(for-each 
  (lambda (x y) 
    (set! result2 (cons (+ x y) result2))
  )
  #(10 20 30) 
  #(5 15 25) 
)
(display "Results (reversed): ")
(display result2)
(newline)
(newline)

;; Test 5: for-each with empty vector
(display "Test 5: for-each with empty vector\n")
(define was-called #f)
(for-each (lambda (x) (set! was-called #t)) #())
(display "Procedure was called: ")
(display was-called)
(newline)
(newline)

(display "All vector tests completed!\n")